package cn.hahah.module.blog.dal.mysql.userfocus;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.userfocus.UserFocusDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.userfocus.vo.*;

/**
 * 用户关注 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserFocusMapper extends BaseMapperX<UserFocusDO> {

    default PageResult<UserFocusDO> selectPage(UserFocusPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserFocusDO>()
                .eqIfPresent(UserFocusDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserFocusDO::getFocusId, reqVO.getFocusId())
                .betweenIfPresent(UserFocusDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserFocusDO::getId));
    }

}